@using Microsoft.AspNetCore.Mvc.Localization
<h2>@T["Typed Route Sample"]</h2>

<p>@T["These two are generated differently but result in the same."]</p>

<ul class="typedRouteExample">
    <li>
        @* You don't need all of these here because it's the same controller & module, but here we demonstrate how it
            would be if it was a different one. *@
        <a asp-area="Lombiq.HelpfulLibraries.Samples"
           asp-controller="TypedRoute"
           asp-action="TypedRouteSample"
           asp-route-text="hello"
           asp-route-number="10">
            @T["ASP.NET Core tag helper URL"]
        </a>
    </li>
    <li>
        <a href="@(Orchard.Action<TypedRouteController>(controller => controller.TypedRouteSample("hello", 10)))">
            @T["Statically typed URL"]
        </a>
    </li>
</ul>

<script asp-name="jQuery" at="Foot"></script>
<script at="Foot" depends-on="jQuery">
    jQuery(function ($) {
        const $typedRouteExample = $('.typedRouteExample');

        const links = $typedRouteExample.find('li a').map((_,  a) => a.href);
        const areAllTheSame = $.unique(links).length === 1;

        $typedRouteExample.after(
            $('<p>')
                .text(@T["Are the URLs the same?"].Json() + ' ')
                .append(
                    $('<span>')
                        .text(areAllTheSame ? @T["Yes"].Json() : @T["No"].Json())
                        .css('color', areAllTheSame ? 'green' : 'red')));
    });
</script>
